﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Xml.Serialization;

namespace wxDemoweb.wxModel
{
    public class wxHandleModel
    {
        /// <summary>
        /// 微信access_token信息
        /// </summary>
        public class access_tokenM
        {
            /// <summary>
            /// 微信access_token
            /// </summary>
            public string access_token { get; set; }

            /// <summary>
            /// 过期时间
            /// </summary>
            public string expires_in { get; set; }
        }

        /// <summary>
        /// oauth 授权
        /// </summary>
        public class oauthM {
            /// <summary>
            /// 公众号appid
            /// </summary>
            public string appid { get; set; }
            /// <summary>
            /// 授权页面
            /// </summary>
            public string redirect_uri { get; set; }
            /// <summary>
            /// 授权类型(snsapi_base 静默授权，snsapi_userinfo 手动授权)
            /// </summary>
            public string response_type { get; set; }
            /// <summary>
            /// 授权code
            /// </summary>
            public string scope { get; set; }
            /// <summary>
            /// 参数
            /// </summary>
            public string state { get; set; }
        }

        /// <summary>
        /// 微信http GET方式请求获得jsapi_ticket
        /// </summary>
        public class access_ticketM
        {
            public string errcode { get; set; }
            public string errmsg { get; set; }
            public string ticket { get; set; }
            public string expires_in { get; set; }
        }

        /// <summary>
        /// 这里通过code换取的是一个特殊的网页授权access_token,与基础支持中的不同
        /// </summary>
        public class oauth_access_token
        {
            public string access_token { get; set; }
            public int expires_in { get; set; }
            public string refresh_token { get; set; }
            public string openid { get; set; }
            public string scope { get; set; }
        }

        public class userInfo
        {
            public string openid { get; set; }
            public string nickname { get; set; }
            public int sex { get; set; }
            public string province { get; set; }
            public string city { get; set; }
            public string country { get; set; }
            public string headimgurl { get; set; }
        }

        /// <summary>
        /// 微信JS配置类
        /// </summary>
        public class wxJSconfig
        {
            /// <summary>
            /// 是否开启调试模式
            /// </summary>
            public bool debug { get; set; }
            /// <summary>
            /// 微信公众号ID
            /// </summary>
            public string appId { get; set; }
            /// <summary>
            /// 随机字符串
            /// </summary>
            public string nonceStr { get; set; }
            /// <summary>
            /// 时间戳
            /// </summary>
            public int timestamp { get; set; }
            /// <summary>
            /// 验证签名
            /// </summary>
            public string signature { get; set; }
        }

        public class wxPayconfig
        {
            /// <summary>
            /// 时间戳
            /// </summary>
            public int timestamp { get; set; }
            /// <summary>
            /// 随机字符串
            /// </summary>
            public string nonceStr { get; set; }
            /// <summary>
            /// packge包
            /// </summary>
            public string package { get; set; }
            /// <summary>
            /// 加密类型  MD5
            /// </summary>
            public string signType { get; set; }
            /// <summary>
            /// 微信支付签名
            /// </summary>
            public string paySign { get; set; }
        }

        /// <summary>
        /// 微信错误信息返回
        /// </summary>
        public class errM
        {
            /// <summary>
            /// 错误代码
            /// </summary>
            public string errcode { get; set; }

            /// <summary>
            /// 错误信息
            /// </summary>
            public string errmsg { get; set; }
        }

        /// <summary>
        /// 统一下单,请求参数
        /// </summary>
        public class packageM
        {
            /// <summary>
            /// 公众账号ID()
            /// </summary>
            [XmlElement("appid")]
            public string appid { get; set; }
            /// <summary>
            /// 商户号
            /// </summary>
            [XmlElement("mch_id")]
            public string mch_id { get; set; }
            /// <summary>
            /// 设备号
            /// </summary>
            [XmlElement("device_info")]
            public string device_info { get; set; }
            /// <summary>
            /// 随机字符串
            /// </summary>
            [XmlElement("nonce_str")]
            public string nonce_str { get; set; }
            /// <summary>
            /// 签名
            /// </summary>
            [XmlElement("sign")]
            public string sign { get; set; }
            /// <summary>
            /// 商品描述
            /// </summary>
            [XmlElement("body")]
            public string body { get; set; }
            /// <summary>
            /// 商品详情
            /// </summary>
            [XmlElement("detail")]
            public string detail { get; set; }
            /// <summary>
            /// 附加数据
            /// </summary>
            public string attach { get; set; }
            /// <summary>
            /// 商户订单号
            /// </summary>
            [XmlElement("out_trade_no")]
            public string out_trade_no { get; set; }
            /// <summary>
            /// 货币类型(CNY)
            /// </summary>
            [XmlElement("fee_type")]
            public string fee_type { get; set; }
            /// <summary>
            /// 总金额,订单总金额，只能为整数
            /// </summary>
            [XmlElement("total_fee")]
            public int total_fee { get; set; }
            /// <summary>
            /// 终端IP
            /// </summary>
            [XmlElement("spbill_create_ip")]
            public string spbill_create_ip { get; set; }
            /// <summary>
            /// 交易起始时间
            /// </summary>
            public string time_start { get; set; }
            /// <summary>
            /// 交易结束时间
            /// </summary>
            public string time_expire { get; set; }
            /// <summary>
            /// 商品标记
            /// </summary>
            public string goods_tag { get; set; }
            /// <summary>
            /// 通知地址
            /// </summary>
            [XmlElement("notify_url")]
            public string notify_url { get; set; }
            /// <summary>
            /// 交易类型
            /// </summary>
            [XmlElement("trade_type")]
            public string trade_type { get; set; }
            /// <summary>
            /// 商品ID
            /// </summary>
            [XmlElement("product_id")]
            public string product_id { get; set; }
            /// <summary>
            /// 用户标识
            /// </summary>
            [XmlElement("openid")]
            public string openid { get; set; }
        }

        /// <summary>
        /// 统一下单返回结果（接口链接：https://api.mch.weixin.qq.com/pay/unifiedorder）
        /// </summary>
        public class package_result
        {
            /// <summary>
            /// 返回状态码
            /// </summary>
            public string return_code { set; get; }
            /// <summary>
            /// 返回信息
            /// </summary>
            public string return_msg { set; get; }
        }

        /// <summary>
        /// 统一下单return_code为success,成功返回结果
        /// </summary>
        public class package_success
        {
            /// <summary>
            /// 公众账号ID
            /// </summary>
            public string appid { set; get; }
            /// <summary>
            /// 商户号
            /// </summary>
            public string mch_id { set; get; }
            /// <summary>
            /// 设备号
            /// </summary>
            public string device_info { set; get; }
            /// <summary>
            /// 随机字符串
            /// </summary>
            public string nonce_str { set; get; }
            /// <summary>
            /// 签名
            /// </summary>
            public string sign { set; get; }
            /// <summary>
            /// 业务结果
            /// </summary>
            public string result_code { set; get; }
            /// <summary>
            /// 错误代码
            /// </summary>
            public string err_code { set; get; }
            /// <summary>
            /// 错误代码描述
            /// </summary>
            public string err_code_des { set; get; }
        }

        /// <summary>
        /// 统一下单最终成功时返回
        /// </summary>
        public class get_prepay_success
        {
            /// <summary>
            /// 交易类型
            /// </summary>
            public string trade_type { set; get; }
            /// <summary>
            /// 预支付交易会话标识(用于后续接口调用中使用，该值有效期为2小时)
            /// </summary>
            public string prepay_id { set; get; }
            /// <summary>
            /// 二维码链接(trade_type为NATIVE是有返回，可将该参数值生成二维码展示出来进行扫码支付)
            /// </summary>
            public string code_url { set; get; }
        }
    }
}